<?php

namespace App\Http\Middleware;

use Closure;

class LoginMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next){   
        //var_dump($request) ;
        //登录权限验证
        //检测session中是否有等录信息
        //echo $request->session()->has('isAdmin');
        //echo "<hr/>";
        //echo $request->session()->has('uid');
        //echo "<hr/>";
        //echo $request->session()->has('uname');
        if($request->session()->has('isAdmin') && $request->session()->has('uid') && $request->session()->has('uname')){
            return $next($request);
        }else{
            return view('/admin/login');
        }
    }
}
